<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue.js"></script>
</head>
<body>
<div id="box">
    <div>事件绑定</div>
    {{username}}
<!--    <button onclick="handleClick()">click</button>-->
<!--    <button v-on:click="handleClick">click</button>-->
    <button @click="handleClick">click</button>
</div>
<script>
    // function handleClick() {
    //     console.log("click")
    //     app.username = 'zhangsan'
    // }

    var obj = {
        data() {
            return {
                username: "lhy",
                isLogin: true,
                color: 'red'
            }
        },
        methods:{
            handleClick(){
                console.log("click")
                this.username = 'zhangsan'
            }
        }
    }
    var app = Vue.createApp(obj).mount("#box")
</script>
</body>
</html>